package com.test.death_lock;

public class Homework1 {
    public static void main(String[] args) throws InterruptedException {
        Account a1 = new Account("我",0.0);
        Account a2 = new Account("媳妇",0.0);
        Account a3 = new Account("账户",3000.0);

        AccountTransfer at1 = new AccountTransfer("我取钱",a3,a1,2000.0);
        AccountTransfer at2 = new AccountTransfer("老婆取钱",a3,a2,2000.0);

        at1.start();
        at2.start();

        at1.join();
        at2.join();

        System.out.println(a1.getName()+"的余额为："+a1.getBalance()+"元");
        System.out.println(a2.getName()+"的余额为："+a2.getBalance()+"元");
        System.out.println(a3.getName()+"的余额为："+a3.getBalance()+"元");
    }
}
